package com.ruoyi.baoming.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.baoming.domain.ExamApproval;
import com.ruoyi.baoming.service.IExamApprovalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 考试报名审核信息Controller
 * 
 * @author xiaosong
 * @date 2024-11-20
 */
@Api(tags = "考试管理-审核管理")
@RestController
@RequestMapping("/baoming/approval")
public class ExamApprovalController extends BaseController
{
    @Autowired
    private IExamApprovalService examApprovalService;

    /**
     * 查询考试报名审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('baoming:approval:list')")
    @GetMapping("/list")
    @ApiOperation("考试审核管理 - 分页查询列表")
    public TableDataInfo list(ExamApproval examApproval)
    {
        startPage();
        List<ExamApproval> list = examApprovalService.selectExamApprovalList(examApproval);
        return getDataTable(list);
    }

    /**
     * 导出考试报名审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('baoming:approval:export')")
    @Log(title = "考试报名审核信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("考试审核管理 - 导出数据")
    public void export(HttpServletResponse response, ExamApproval examApproval)
    {
        List<ExamApproval> list = examApprovalService.selectExamApprovalList(examApproval);
        ExcelUtil<ExamApproval> util = new ExcelUtil<ExamApproval>(ExamApproval.class);
        util.exportExcel(response, list, "考试报名审核信息数据");
    }

    /**
     * 获取考试报名审核信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('baoming:approval:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("考试审核管理 - 根据ID获取详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(examApprovalService.selectExamApprovalById(id));
    }

    /**
     * 新增考试报名审核信息
     */
    @PreAuthorize("@ss.hasPermi('baoming:approval:add')")
    @Log(title = "考试报名审核信息", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("考试审核管理 - 新增数据")
    public AjaxResult add(@RequestBody ExamApproval examApproval)
    {
        return toAjax(examApprovalService.insertExamApproval(examApproval));
    }

    /**
     * 修改考试报名审核信息
     */
    @PreAuthorize("@ss.hasPermi('baoming:approval:edit')")
    @Log(title = "考试报名审核信息", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("考试审核管理 - 修改数据")
    public AjaxResult edit(@RequestBody ExamApproval examApproval)
    {
        return toAjax(examApprovalService.updateExamApproval(examApproval));
    }

    /**
     * 删除考试报名审核信息
     */
    @PreAuthorize("@ss.hasPermi('baoming:approval:remove')")
    @Log(title = "考试报名审核信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation("考试审核管理 - 删除数据")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(examApprovalService.deleteExamApprovalByIds(ids));
    }
}
